# coding: UTF-8
# ----------
# Project_Name : pythonProject
# File_Name : huangcongbing
# Author : asus
# Date_Time:2022/4/25 15:53
# Description :
# ----------

import unittest
from po.common.read_write_file import read_csv
from selenium import webdriver
import time
from selenium.webdriver.common.by import By
from selenium.webdriver.support.wait import WebDriverWait
from selenium.webdriver.support import expected_conditions
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.action_chains import ActionChains
from  po.page.index_page import IndexPage   #导入首页类


class Index004(unittest.TestCase):
    def setUp(self) -> None:
        #调试使用
        self.driver = webdriver.Chrome()
        self.wait  = WebDriverWait(self.driver,30)

        #生成首页类对象
        self.index_page = IndexPage(self.driver,self.wait)
    #读取银狐账号数据
        self.data = read_csv('../data/users.csv')

    def test(self):
        for users in self.data:
            print(users)
            self.driver.get('http://www.baidu.com/')
            self.driver.maximize_window()

            self.index_page.click_top_login_button()
            self.index_page.input_user(users[0])
            self.index_page.input_pwd(users[1])
            self.index_page.click_login()
            # time.sleep(5)

    def tearDown(self) -> None:
        self.driver.quit()